/*
 * Created on Jul 6, 2005
 *
 */
package com.erclab.internal.xpresso.util;

/**
 * @author Enrique Rodriguez.
 *
 */
public class MysqlFormatter {

	public static String formatToStandardDate(String originalValue){
		if (originalValue == null || originalValue.equals(""))
			return "";
		String[] theDateParts = originalValue.split("-");
		String formatedDate = theDateParts[1];
		formatedDate += "/" + theDateParts[2].substring(0, 2);
		formatedDate += "/" + theDateParts[0];
		if(formatedDate.equals("00/00/0000"))
			return "";
		return formatedDate;
	}
	
	public static String convertDateToMySqlFormat(String submittedValue){
		String[] theDateParts = submittedValue.split("/");
		String formatedDate = theDateParts[2];
		formatedDate += "-" + theDateParts[0];
		formatedDate += "-" + theDateParts[1];
		return formatedDate;
	}

}
